<?php

namespace app\factory\register;


use app\model\attention\Attention;
use app\model\publish\Blog;
use app\model\publish\Source;
use app\model\register\User;
use app\modelOpreate\register\UserOpe;
use app\tool\login\UpdatePasswordHandle;
use app\tool\register\SendVerifyHandle;
use app\tool\register\VerifyCreateTool;
use app\tool\user\PersonMsgUpdate;

/**
 * ClassName:一号注册类
 * @author leijunxiang
 * @time 2024/8/31
 * @auditor
 */
class RegToolOne
{

    /**
     * 注册工具()
     * @return void
     */
    public function regTool($objKey, $type)
    {
        $obj = null;
        if (empty($objKey) && empty($type)) {
            return null;
        }
        switch ($type) {
            //加密工具类
//            case EncryptionTool::TOOL_ENCRYPTION_TOOL:
//            $obj = new EncryptionTool();
//                bind($objKey, $obj);
//                break;
            //验证码生成工具
            case VerifyCreateTool::TOOL_VERIFY_CREATE_TOOL:
                $obj = new VerifyCreateTool();
                bind($objKey, $obj);
                break;
            //发送验证码处理器
            case SendVerifyHandle::TOOL_SEND_VERIFY_HANDLE:
                $obj = new SendVerifyHandle();
                bind($objKey, $obj);
                break;
            //用户操作类
            case UserOpe::TOOL_USER_OPE:
                $obj = new UserOpe();
                bind($objKey, $obj);
                break;
        }
        return $obj;
    }

    /**
     * 注册M层
     * @return void
     */
    public function regModel($objKey, $type)
    {
        $obj = null;
        if (empty($objKey) && empty($type)) {
            return null;
        }
        switch ($type) {
            //框架返回协议对象
//            case ResponseAgreement::MODEL_RESPONSE_AGREEMENT:
//                $obj = new ResponseAgreement();
//                bind($objKey, $obj);
//                break;
            //用户类
            case User::MODEL_USER:
                $obj = new User();
                bind($objKey, $obj);
                break;
            //关注类
            case Attention::MODEL_ATTENTION:
                $obj = new Attention();
                bind($objKey, $obj);
                break;
            //博客类
            case Blog::MODEL_BLOG:
                $obj = new Blog();
                bind($objKey, $obj);
                break;
            //资源包
            case Source::MODEL_SOURCE:
                $obj = new Source();
                bind($objKey, $obj);
                break;
        }
        return $obj;
    }

    /**
     * 注册常驻M层
     * @return void
     */
    public function regResidentModel($objKey, $type)
    {
        $obj = null;
        if (empty($objKey) && empty($type)) {
            return null;
        }
        switch ($type) {
            //框架返回协议对象
//            case ResponseAgreement::MODEL_RESPONSE_AGREEMENT:
//                $obj = new ResponseAgreement();
//                bind($objKey, $obj);
//                break;
        }
        return $obj;
    }
}